package com.settlement.system.model.entity.common;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.settlement.system.converter.DateFormatYmdHmSlashConvert;
import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import java.io.Serializable;
import java.util.Date;

/**
 * 营销工具原始账单
 * @author xiaochuan
 * @since 2022-12-21
 */
@Data
@ExcelIgnoreUnannotated
@HeadStyle(fillBackgroundColor = 9,fillForegroundColor = 9)
@HeadRowHeight(value = 20)
@HeadFontStyle(fontHeightInPoints = 14)
public class TblMarketToolBillDetail extends BaseModel implements Serializable {


    /**
     * 平台
     */
    @ColumnWidth(16)
    @ExcelProperty(value = "平台")
    @ApiModelProperty(value = "平台")
    @NotBlank(message = "平台不能为空")
    private String channelName;

    /**
     * 平台编码
     */
    @ApiModelProperty(value = "平台编码")
    private String channelNo;

    /**
     * 账单类型
     */
    @ColumnWidth(28)
    @ExcelProperty(value = "账单类型")
    @ApiModelProperty(value = "账单类型")
    @NotBlank(message = "账单类型不能为空")
    private String billType;

    /**
     * NC店铺编码
     */
    @ColumnWidth(20)
    @ExcelProperty(value = "NC店铺编码")
    @ApiModelProperty(value = "NC店铺编码")
    @NotBlank(message = "NC店铺编码不能为空")
    private String ncShopNo;

    /**
     * 店铺名称
     */
    @ColumnWidth(28)
    @ExcelProperty(value = "店铺名称")
    @ApiModelProperty(value = "店铺名称")
    private String ncShopName;

    /**
     * 费用类型
     */
    @ColumnWidth(16)
    @ExcelProperty(value = "费用类型")
    @ApiModelProperty(value = "费用类型")
    @NotBlank(message = "费用类型不能为空")
    private String costType;

    /**
     * 会计期间
     */
    @ColumnWidth(16)
    @ExcelProperty(value = "会计期间")
    @ApiModelProperty(value = "会计期间")
    @NotBlank(message = "会计期间不能为空")
    private String accountingPeriod;

    /**
     * 操作时间
     */
    @ColumnWidth(20)
    @ExcelProperty(value = "操作时间",converter = DateFormatYmdHmSlashConvert.class)
    @ApiModelProperty(value = "操作时间")
    @NotEmpty(message="操作时间不能为空")
    @JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss", timezone = "GMT+8")
    private Date happenTime;

    /**
     * 操作金额
     */
    @ColumnWidth(16)
    @ExcelProperty(value = "操作金额")
    @ApiModelProperty(value = "操作金额",dataType = "java.math.BigDecimal")
    @NotEmpty(message = "操作金额不能为空")
    @Length(max = 19,message = "操作金额长度不能大于19")
    @Pattern(regexp="^-?([1-9]\\d*|0)(\\.[0-9]*)?$",message="操作金额为数字")
    @Pattern(regexp="^-?([1-9]\\d*|0)(\\.[0-9]{0,2})?$",message="操作金额小数不能超过2位")
    private String amount;

    /**
     * 账户类型
     */
    @ColumnWidth(16)
    @ExcelProperty(value = "账户类型")
    @ApiModelProperty(value = "账户类型")
    private String accountType;

    /**
     * 收支类型
     */
    @ColumnWidth(16)
    @ExcelProperty(value = "收支类型")
    @ApiModelProperty(value = "收支类型")
    @NotBlank(message = "收支类型不能为空")
    private String waterType;

    /**
     * 操作后余额
     */
    @ColumnWidth(16)
    @ExcelProperty(value = "操作后余额")
    @ApiModelProperty(value = "操作后余额",dataType = "java.math.BigDecimal")
    @NotBlank(message = "操作后余额不能为空")
    @Length(max = 19,message = "操作后余额长度不能大于19")
    @Pattern(regexp="^-?([1-9]\\d*|0)(\\.[0-9]*)?$",message="操作后余额为数字")
    @Pattern(regexp="^-?([1-9]\\d*|0)(\\.[0-9]{0,2})?$",message="操作后余额小数不能超过2位")
    private String accountBalance;

    /**
     * 操作备注
     */
    @ColumnWidth(20)
    @ExcelProperty(value = "操作备注")
    @ApiModelProperty(value = "操作备注")
    private String note;

    /**
     * 交易类型
     */
    @ColumnWidth(16)
    @ExcelProperty(value = "交易类型")
    @ApiModelProperty(value = "交易类型")
    private String transactionType;

    /**
     * 原始账单ID
     */
    @ApiModelProperty(value = "原始账单ID")
    private String originBillId;

    /**
     * 余额标识
     */
    @ColumnWidth(16)
    @ExcelProperty(value = "余额标识")
    @ApiModelProperty(value = "余额标识")
    private String balanceMark;

    /**
     * 供应商名称
     */
    @ColumnWidth(20)
    @ExcelProperty(value = "供应商名称")
    @ApiModelProperty(value = "供应商名称")
    @NotBlank(message = "供应商名称不能为空")
    private String supplierName;

    /**
     * 资金类型
     */
    @ColumnWidth(16)
    @ApiModelProperty(value = "资金类型")
    private String moneyType;

    @Override
    public String toString() {
        return "TblMarketToolBillDetail{" +
                "channelName='" + channelName + '\'' +
                ", channelNo='" + channelNo + '\'' +
                ", billType='" + billType + '\'' +
                ", ncShopName='" + ncShopName + '\'' +
                ", ncShopNo='" + ncShopNo + '\'' +
                ", costType='" + costType + '\'' +
                ", accountingPeriod='" + accountingPeriod + '\'' +
                ", happenTime=" + happenTime +
                ", amount=" + amount +
                ", accountType='" + accountType + '\'' +
                ", waterType='" + waterType + '\'' +
                ", accountBalance=" + accountBalance +
                ", note='" + note + '\'' +
                ", transactionType='" + transactionType + '\'' +
                ", supplierName='" + supplierName + '\'' +
                ", originBillId='" + originBillId + '\'' +
                ", balanceMark='" + balanceMark + '\'' +
                ", moneyType='" + moneyType + '\'' +
                '}';
    }
}
